import axios from "@/axios/axios.js";

/**
 * 
 * @param {username,password} obj 
 * @returns 
 */
export const login =(obj)=> axios.post('login',obj)


/**
 * 
 * @returns 
 */
 export const menus =()=> axios.get('menus')


 /**
  * 
  * @param {pagenum,pagesize} obj 
  * @returns 
  */
export const getUsers=(obj)=>axios.get('users',{params:obj})
 
/**
 * 
 * @param {username,password} obj 
 * @returns 
 */
export const postUsers=(obj)=>axios.post('users',obj)

/**
 * 删除
 * @param {Number} id
 * @returns 
 */
export const deleteUsers=(id)=>axios.delete(`users/${id}`)

/**
 * 状态
 * @param {Number} id 
 * @param {Boolean} type 
 * @returns 
 */
export const putUsers=(id,type)=>axios.put(`users/${id}/state/${type}`)

/**
 * 
 * @param {ID} id 
 * @returns 
 */
export const getUser=(id)=>axios.get(`users/${id}`)


/**
 * 编辑
 * @param {ID} id
 * @returns 
 */
export const putUser=(id,obj)=>axios.put(`users/${id}`,obj)

/**
 * 
 * @param {*} id 
 * @returns 
 */
export const users_get=(id)=>axios.get(`users/${id}`)


/**
 * 
 * @param {*} id 
 * @param {*} rid 
 * @returns 
 */
export const users_put=(id,rid)=>axios.put(`users/${id}/role`,rid)